import Vue from "vue";
import Router from "vue-router";

Vue.use(Router);
let routes = [];
require
  .context("./modules", false, /\.js$/)
  .keys()
  .forEach(ele => {
    require(`./modules/${ele.replace("./", "")}`).default.forEach(mod => {
      mod.path = `/${ele.replace(/^.\/(.*)\.js$/g, "$1")}${mod.path}`;
      mod.name = mod.path;
      routes.push(mod);
    });
  });

console.log(routes);
export default new Router({ routes });
